unit session;

interface
uses
// our
main,player,  media, settings,utils, defaults, display, engine,

// system
sysutils, menus, windows, forms, Controls;


// Session --->
type TKSession = class
private
    curMedia: TKMedia;
    timestart: ttime;
    timeend: ttime;


    frm: Tklipermainform;
    player: Tkplayer;
public
    last_state: tkliperstate;
    started_from_fullscreen: boolean;
    constructor Create(form: Tklipermainform; pl: Tkplayer);
    procedure playMedia(media: TKMedia);
    function getCurrentMedia: TKMedia;
  
end;

var ksession: TKsession;

implementation

{ TKSession }

constructor TKSession.Create(form: Tklipermainform; pl: Tkplayer);
begin
     self.player:=pl;
     last_state := STATE_STOP;
     if (fileexists(extractfiledir(paramstr(0)) + '\recent.ini')) then begin

  end;
end;


function TKSession.getCurrentMedia: TKMedia;
begin
  result:=curMedia;
end;

procedure TKSession.playMedia(media: TKMedia);
var
  ind: integer;
begin
  curMedia:=media;
   with frm do begin
  last_state := STATE_UNKNOWN;

  ksession.started_from_fullscreen := kdisplay.flags.isFullscreen;
  settingsform.getconfig;
  screen.Cursor := crHourGlass;
 //oader1.start(translatestr('KTS_INFO_MAINFORM_LOADING'));

  mainform.playButton.Enabled := false;
  mainform.stopButton.Enabled := true;
  mainform.pauseButton.Enabled := false;
  self.player.mode := MODE_VIDEO;

  self.player.engine.setconfig(sets);
  self.player.engine.open(media.url);
  self.player.engine.play;
  end;

end;

end.
